#include"epollServer.hpp"
#include<memory>
using namespace std;
using namespace epoll_ns;

static void Usage(std::string proc)
{
    std::cerr<<"Usage:\n\t" <<proc <<" port"<<std::endl;
}

std::string echo(const std::string& message)
{
    return "i am epoll server,"+message;
}

// ./epollServer 8080
int main(int argc,char* argv[])
{
    if(argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERR);
    }
    uint16_t port = atoi(argv[1]);

    unique_ptr<EpollServer> epollsvr(new EpollServer(echo,port));

    epollsvr->initServer();

    epollsvr->start();


    return 0;
}
